package cn.jasonone.tio.client.test;

import cn.jasonone.tio.tcp.handler.HeartbeatHandler;
import org.springframework.stereotype.Component;
import org.tio.core.ChannelContext;

import java.io.Serializable;

/**
 * @author xujie
 * @version 1.0
 * @date 2022/1/21 8:36
 */
@Component
public class HeaHandler implements HeartbeatHandler {
    @Override
    public Serializable createHeartbeat(ChannelContext channelContext) throws Exception {
        return "心跳测试";
    }

    @Override
    public void onHeartbeat(Object heartbeat, ChannelContext ctx) throws Exception {
        System.out.println("接收心跳:"+heartbeat);
    }
}
